using MediatR;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Services.Initial.Extensions;
using Services.Activity.Domain.Entities;
using Zack.Infrastructure.EFCore;

namespace Services.Activity.Infrastructure;
public class ActivityDbContext(DbContextOptions options, IMediator? mediator) : BaseDbContext(options, mediator)
{
    public DbSet<VoluntaryActivity> Activities { get; private set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
        modelBuilder.MyEnableSoftDeletionGlobalFilter();
    }
}
public class ActivityDbContextDesignTimeFactory : IDesignTimeDbContextFactory<ActivityDbContext>
{
    public ActivityDbContext CreateDbContext(string[] args)
    {
        var optionsBuilder = DbContextOptionsBuilderFactory.Create<ActivityDbContext>();
        return new ActivityDbContext(optionsBuilder.Options,null);
    }
}